﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibGreen.Oscar.ObjectManagers.SSI
{
	/// <summary>
	/// Encapsulates an SSI item representing a group of contacts
	/// </summary>
	public class BuddyGroup : IServerSideItem
	{
		/// <summary>
		/// The name of the group
		/// </summary>
		public string Name = "";

		/// <summary>
		/// The group's ID number
		/// </summary>
		public ushort ID = 0;

		/// <summary>
		/// The IDs of the <see cref="Buddy"/> objects contained in this group
		/// </summary>
		public List<ushort> Children = null;

		/// <summary>
		/// The order of the group in the master list
		/// </summary>
		public int Order = 0;

		#region IServerSideItem Members

		/// <summary>
		/// The group ID of the group -- always zero
		/// </summary>
		public ushort ItemID
		{
			get { return 0; }
		}

		#endregion

		#region IComparable Members
		/// <summary>
		/// Compares the current instance with another object of the same type.
		/// </summary>
		/// <param name="obj">An object to compare with this instance.</param>
		/// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
		public int CompareTo (object obj)
		{
			if (obj is BuddyGroup) {
				return this.ID.CompareTo ((obj as BuddyGroup).ID);
			}
			return -1;
		}

		#endregion
	}
}
